package xyz.zhouzhaodong.rabbitmq.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * 消费者
 * @author zhouzhaodong
 */
@Component
public class ReceiverController {

    Logger logger = LoggerFactory.getLogger(ReceiverController.class);

    @RabbitHandler
    @RabbitListener(queues = "queueOne")
    public void processA(String message){
        logger.info("queueOne接收消息时间为：" + new Date());
        logger.info("queueOne接收消息为：" + message);
    }

    @RabbitHandler
    @RabbitListener(queues = "queueTwo")
    public void processB(String message){
        logger.info("queueTwo接收消息时间为：" + new Date());
        logger.info("queueTwo接收消息为：" + message);
    }

    @RabbitHandler
    @RabbitListener(queues = "queueThree")
    public void processC(String message){
        logger.info("queueThree接收消息时间为：" + new Date());
        logger.info("queueThree接收消息为：" + message);
    }

}
